<ul id="adminmenu">
    <li class="menu-dashboard wp-first-item menu-top menu-top-first menu-top-last">
        <div class="wp-menu-image"><br /></div>
        <div class="wp-menu-toggle" style="display: none;"><br /></div>
        <a target="_blank" tabindex="1" class="wp-first-item menu-top menu-top-first menu-top-last" href="<?php echo base_url();?>">Homepage</a>
    </li>
    <li class="wp-menu-separator"><br /></li>
    <?php 
		$main_menu = array();
		$generate_menu = $this->session->userdata('generate_menu');
		$last_menu = end(array_keys($generate_menu));
		$active_main = $this->uri->segment(1);
		$active_sub = $this->uri->segment(2);
	?>
<!--	 wp-has-current-submenu wp-menu-open
	wp-has-current-submenu-->
	<?php foreach($generate_menu as $key => $value):?>
		<li class="<?php echo $value['main_icon'];?> wp-has-submenu <?php echo ($value['main_page']==$active_main ? 'wp-has-current-submenu wp-menu-open':'');?> menu-top <?php echo ($last_menu==$key ? 'menu-top-last':'');?>">
	        <div class="wp-menu-image"><br /></div>
	        <div class="wp-menu-toggle"><br /></div>
	        <a tabindex="1" class="wp-has-submenu <?php echo ($value['main_page']==$active_main ? 'wp-has-current-submenu':'');?> menu-top <?php echo ($last_menu==$key ? 'menu-top-last':'');?>" href="javascript:void(0);"><?php echo $value['main_name'];?></a>
	        <div class="wp-submenu"><div class="wp-submenu-head"><?php echo $value['main_name'];?></div>
	        <ul>
				<?php foreach($value['submenu'] as $key2 => $items):?>
	            <li class="<?php echo ($key2==0 ? 'wp-first-item':'');?> <?php echo ($value['main_page']==$active_main && $items['sub_page']==$active_sub ? 'current':'');?>"><a class="<?php echo ($key2==0 ? 'wp-first-item':'');?> <?php echo ($value['main_page']==$active_main && $items['sub_page']==$active_sub ? 'current':'');?>" tabindex="1" href="<?php echo base_url().$value['main_page'].'/'.$items['sub_page'];?>"><?php echo $items['sub_name'];?></a></li>
				<?php endforeach;?>
			</ul>
			</div>
		</li>
	<?php endforeach;?>      
    <li class="wp-menu-separator"><br /></li>
</ul>